#include("./layout.html")
#include("_sidebar.html")
#include("_include.html")

#@layout()

#define script()
#@sidebarIncludeJs()
#end

#define css()
#@productListIncludeCss()
#@sidebarIncludeCss()
#end

#define content()
<div class="col-md-8 col-lg-8 col-xl-9 #(option('whimurmur_sidebar_position') == 'left' ? 'offset-md-4 offset-lg-4 offset-xl-3 cl-right' : 'cl-left')">
    #set(topProduct={})
    #set(classify=org.apache.commons.lang3.StringUtils::substring(C.request.servletPath, org.apache.commons.lang3.StringUtils::lastIndexOf(C.request.servletPath, '/') + 1))
    #products(flag=classify + "-top", count=5)
    #for(product : products)
        #set(topProduct[''+product.id]='top')
        <div class="cl-card pr bg-light">

            <div class="row" class="pro-list">
                <div class="col-lg-3 col-md-4 col-sm-12 cl-card-image">
                    <img src="#(product.thumbnail ? product.thumbnail : (product.showImage ? product.showImage : 'img/default-img.png'))" class="img-fluid" >
                </div>

                <div class="col-lg-9 col-md-8 col-sm-12 cl-card-main">
                    <h3 class="cl-card-main-title">
                       <a href="#(product.url)">#(product.title ??)</a>
                    </h3>

                    <p class="cl-card-main-info">
                        #maxLength(product.text,100)
                    </p>

                    <div class="product-list-btn">
                        <div class="price-box">
                            <p class="list-price">¥ #number(product.price)</p>

                            <p class="list-number"><span>#(product.sales_count ?? 0)</span> 人已购买</p>
                        </div>
                        <div>
                            <a class="list-more" href="#(product.url)">查看宝贝 >  </a>
                        </div>

                    </div>

                </div>
            </div>
            <h3><span class="card-top-flag badge badge-success">置顶</span></h3>
        </div>
    #end
    #end


    #productPage(pageSize=java.lang.Integer::parseInt(option('whimurmur_list_size', 15)))
    #for(product : productPage.list)
    #if(!topProduct[''+product.id])
    <div class="cl-card bg-light">

            <div class="row" class="pro-list">
                <div class="col-lg-3 col-md-4 col-sm-12 cl-card-image">
                    <img src="#(product.thumbnail ? product.thumbnail : (product.showImage ? product.showImage : 'img/default-img.png'))" class="img-fluid" >
                </div>

                <div class="col-lg-9 col-md-8 col-sm-12 cl-card-main">
                    <h3 class="cl-card-main-title">
                       <a href="#(product.url)">#(product.title ??)</a>
                    </h3>

                    <p class="cl-card-main-info">
                        #maxLength(product.text,100)
                    </p>

                    <div class="product-list-btn">
                        <div class="price-box">
                            <p class="list-price">¥ #number(product.price)</p>

                            <p class="list-number"><span>#(product.sales_count ?? 0)</span> 人已购买</p>
                        </div>
                        <div>
                            <a class="list-more" href="#(product.url)">查看宝贝 >  </a>
                        </div>

                    </div>

                </div>
            </div>

    </div>
    #end
        #if(for.count==1 && option('whimurmur_list_ad_1' ??))
            <div class="cl-card card-link">
                <div class="row">
                    <div class="col-lg-12 col-md-12 col-sm-12 cl-card-main bg-light">
                        <div class="list-1-ad bg-light" id="list-1-ad" style="margin-top: 0; padding: 0">
                            <div class="list-1-ad-main">
                                <div id="list-1-ad-content" class="m-1 ad-content">
                                    #option("whimurmur_list_ad_1" ??)
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        #else if(for.count==5 && option('whimurmur_list_ad_2' ??))
            <div class="cl-card card-link">
                <div class="row">
                    <div class="col-lg-12 col-md-12 col-sm-12 cl-card-main bg-light">
                        <div class="list-2-ad bg-light" id="list-2-ad" style="margin-top: 0; padding: 0">
                            <div class="list-2-ad-main">
                                <div id="list-2-ad-content" class="m-1 ad-content">
                                    #option("whimurmur_list_ad_2" ??)
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        #else if(for.count==10 && option('whimurmur_list_ad_3' ??))
            <div class="cl-card card-link">
                <div class="row">
                    <div class="col-lg-12 col-md-12 col-sm-12 cl-card-main bg-light">
                        <div class="list-3-ad" id="list-3-ad" style="margin-top: 0; padding: 0">
                            <div class="list-3-ad-main">
                                <div id="list-3-ad-content" class="m-1 ad-content">
                                    #option("whimurmur_list_ad_3" ??)
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        #end
    #end



    #productPaginate()
    <nav aria-label="">
        <ul class="pagination justify-content-center">
            #for(page : pages)
            <li class="page-item #(page.style)"><a class="page-link" href="#(page.url ??)">#(page.text)</a></li>
            #end
        </ul>
    </nav>
    #end
    #end


</div>



<div class="col-md-4 col-lg-4 col-xl-3 #(option('whimurmur_sidebar_position') == 'left' ? 'offset-mdn-8 offset-lgn-8 offset-xln-9 offset-smn-0 cl-left' : 'cl-right')">

    #@sidebarContent()

</div>
#end